<template>
  <div>
    <div class="title">
      <div>Price <i :class="[icon]"></i></div>
      <el-dropdown @command="handleCommand">
        <span class="el-dropdown-link sort">
          Sort by：<span>{{command}}</span><i class="el-icon-arrow-down el-icon--right"></i>
        </span>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item command="升序">升序</el-dropdown-item>
          <el-dropdown-item command="降序">降序</el-dropdown-item>
          <el-dropdown-item command="Default">Default</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </div>
    <div class="content">
      <div class="left">
        <div class="price-title">PRICE:</div>
        <div class="price-range"
             v-for="(item,index) of prices"
             :key="index"
             @click="handleRange(item,index)"
             :class="index==currentIndex?'red':''">
          {{item.min}} - {{item.max}}
        </div>
      </div>
      <div class="right">
        <div class="goodsCard">
          <div class="item"
               v-for="(item,index) of goods"
               :key="index">
            <div class="img">
              <img class="goodsImg"
                   :src="item.productImage"
                   alt="">
            </div>
            <div class="name">{{item.productName}}</div>
            <div class="price">￥{{item.salePrice}}</div>
            <el-button type="danger"
                       plain @click="addCart(item._id)">加入购物车</el-button>
          </div>
        </div>
        <el-pagination @size-change="handleSizeChange"
                       @current-change="handleCurrentChange"
                       :current-page.sync="currentPage"
                       :page-sizes="[4, 6, 8, 10, 12]"
                       :page-size="pageSize"
                       layout="sizes, prev, pager, next"
                       :total="total">
        </el-pagination>
      </div>
    </div>
  </div>
</template>

<script>
export default {
    
}
</script>

<style scoped>

.title {
  margin-top: 20px;
  height: 40px;
  padding: 10px 40px;
  width: 1129px;
  background-color: white;
  line-height: 20px;
  box-sizing: border-box;
}
.title div {
  float: right;
}
.sort {
  margin-right: 20px;
}
.sort span {
  color: #f4b28c;
}
.el-dropdown-link {
  cursor: pointer;
  color: #409eff;
}
.el-icon-arrow-down {
  font-size: 12px;
}
.content {
  width: 1129px;
  box-sizing: border-box;
  margin-top: 20px;
  display: flex;
}
.left {
  width: 230px;
}
.price-title {
  font-weight: bold;
}
.price-range {
  cursor: pointer;
}
.red {
  color: red;
}
.left div {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
}
.right {
  width: 1090px;
}
.img {
  text-align: center;
}
.goodsImg {
  width: 150px;
  text-align: center;
}
.goodsCard {
  display: flex;
  flex-wrap: wrap;
}
.item {
  border: 1px solid #eee;
  background-color: white;
  font-size: 14px;
  margin-right: 20px;
  margin-bottom: 20px;
  box-sizing: border-box;
  padding: 0 5px;
}
.name {
  width: 200px;
  text-align: center;
}
.price {
  color: red;
  margin-top: 20px;
}
.el-button--danger.is-plain {
  margin-top: 10px;
  color: red;
  border-color: red;
  background-color: white;
  width: 180px;
  margin-left: 10px;
  margin-bottom: 10px;
}
.el-pagination {
  width: 370px;
  margin-left: auto;
  margin-right: auto;
}
</style>